from django.db import models

# Create your models here.


class Alipay(models.Model):
    out_trade_no = models.CharField(max_length=23, verbose_name="订单号", unique=True)
    subject = models.CharField(max_length=50, verbose_name="商品名称")
    total_amount = models.FloatField(verbose_name="金额")
    user = models.CharField(max_length=11, verbose_name="用户")
    buyer = models.CharField(max_length=50, verbose_name="支付宝买家账号", null=True)
    creat_time = models.DateTimeField(verbose_name="订单创建时间", null=True)
    pay_time = models.DateTimeField(verbose_name="支付时间", null=True)
    is_successful = models.BooleanField(default=False, verbose_name="是否交易成功")
    is_cancel = models.BooleanField(default=False, verbose_name="订单是否被取消")

    class Meta:
        db_table = "AliPay"
        verbose_name = "订单"  # 在后台显示的名称
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.out_trade_no